Skip to content

Show the environment badge in the top bar again - #106695

Merged
shawnborton merged 5 commits into
mainfrom
ionatan_readdenvironmentbadge
Nov 13, 2026
Merged

shawnborton merged 5 commits into
mainfrom
ionatan_readdenvironmentbadge

Conversation

@iwiznia

@iwiznia iwiznia commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Brings back the environment badge (DEV, STG, QA, ADHOC), so it's easy to tell you are not on production. Following the design mocks, it shows inline after the Expensify logo in the flat navigation bar, and inline after the top bar title everywhere else (narrow layout, and the wide icon bar used without the flat nav beta and on tablets). The component and its style helper are the same ones deleted in 827a3bb, with a label added for QA and without pressable, since its onPress did nothing.

Fixed Issues

$ #106694
PROPOSAL:

Tests

  1. Run the app locally and sign in
  2. In the wide layout with the flat navigation bar, verify a red DEV badge shows inline after the Expensify logo and not next to the page title
  3. In the narrow layout, verify the DEV badge shows inline after the top bar title (Home, Inbox, Spend, Insights, Workspaces, Account)
  4. In the wide layout with the icon bar (no flatNav beta), verify the DEV badge shows inline after the page title

Wide, flat navigation bar:
flat wide

Narrow:
inline narrow

Wide, icon bar (I forced useShouldUseFlatNavigationBar to return false locally to check this one):
icon wide

Ad hoc internal test builds show v<version> PR:<number> instead, so I temporarily forced that label locally to check the badge grows to fit it (the PR number is empty in dev, and the color is red because the environment is still dev):

adhoc wide

adhoc narrow

  • Verify that no errors appear in the JS console

Offline tests

No

QA Steps

  1. Sign in on staging
  2. Verify a green STG badge shows inline after the Expensify logo (wide) or after the top bar title (narrow)
  3. Verify no badge shows on production
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@iwiznia
iwiznia requested review from a team as code owners November 12, 2026 10:32
@iwiznia iwiznia self-assigned this Nov 12, 2026
@melvin-bot
melvin-bot Bot requested review from mananjadhav and removed request for a team November 12, 2026 10:33
@melvin-bot

melvin-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

@mananjadhav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from trjExpensify and removed request for a team November 12, 2026 10:33
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T10:37:57.792750Z 15b4411 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@shawnborton

Copy link
Copy Markdown
Contributor

cc @Expensify/design - I wonder if we should just put these little badges in line with the logo on web, and then inline with the page header on mobile? Rather than right below.

@codecov

codecov Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/components/EnvironmentBadge.tsx 100.00% <100.00%> (ø)
.../components/Navigation/FlatNavigationBar/index.tsx 100.00% <100.00%> (ø)
src/components/Navigation/TopBar.tsx 94.28% <100.00%> (+0.34%) ⬆️
src/styles/index.ts 65.21% <ø> (-0.58%) ⬇️
src/styles/utils/index.ts 69.37% <62.50%> (-0.07%) ⬇️
... and 182 files with indirect coverage changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 15b44112df

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const error = environment !== CONST.ENVIRONMENT.STAGING && environment !== CONST.ENVIRONMENT.ADHOC;

const badgeEnvironmentStyle = StyleUtils.getEnvironmentBadgeStyle(success, error, adhoc);
const text = isInternalTestBuild() ? `v${pkg.version} PR:${CONST.PULL_REQUEST_NUMBER}` : ENVIRONMENT_SHORT_FORM[environment];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Let the ad-hoc label expand to its content

On internal ad-hoc PR builds, this branch produces a long label such as v9.5.37-0 PR:106694, but the badge still receives styles.headerEnvBadge, which fixes its width at 22 px, while Badge renders the text with numberOfLines={1}. The version and PR number will therefore be truncated or overflow the small colored background, making the identifying information unreadable; use a content-sized style for internal-test builds instead of the fixed-width short-form badge.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the fixed width was there since before the badge was removed. Removed it in b08e9da, environmentBadge already has minWidth: 22 so the short labels look the same and the ad hoc one grows to fit.

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

cc @Expensify/design - I wonder if we should just put these little badges in line with the logo on web, and then inline with the page header on mobile? Rather than right below.

That's where my head was going as well.

@iwiznia

iwiznia commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@shawnborton not sure exactly what you mean, can you show me? Also does it matter much if this is only seen internally? No real customer uses dev/staging/adhoc builds.

@shawnborton

Copy link
Copy Markdown
Contributor

Rough mocks but this is what I mean:

image

@iwiznia

iwiznia commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

I see, want me to update it to match that?

@shawnborton

Copy link
Copy Markdown
Contributor

Yes, if you don't mind! I think it will feel a little nicer and let the designers sleep at night 🤣

@iwiznia

iwiznia commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

ok pushed. @shawnborton please review.

@shawnborton

Copy link
Copy Markdown
Contributor

Sorry for the delay and sorry to nitpick, but can we reduce this gap by 2px?

CleanShot 2026-11-12 at 9 31 44 PM@2x

The others look fine though. But since the "y" creates negative space on the right side, we should tighten it up.

@mananjadhav mananjadhav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment on the style and also if we can add some test. The codecov job fails.

Comment thread src/styles/index.ts
left: -8,
height: 12,
width: 22,
paddingLeft: 4,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paddingLeft and paddingRight of 4 never show. environmentBadge is applied after this and sets paddingHorizontal: 7. Can we drop this then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is the other way around, in RN (and react-native-web) the longhand paddingLeft/paddingRight win over paddingHorizontal no matter the order, so the 4 is what shows and the paddingHorizontal: 7 in environmentBadge is the one that never applies. The DEV badge renders 22px wide (its minWidth), with 7 it would be wider than that.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. My bad

@iwiznia
iwiznia requested a review from mananjadhav November 12, 2026 21:48
@iwiznia

iwiznia commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

@shawnborton check it out, I think I did what you wanted?

@shawnborton

Copy link
Copy Markdown
Contributor

Nice, can't hurt to just send it and we can always adjust later.

@mananjadhav

This comment has been minimized.

@mananjadhav

Copy link
Copy Markdown
Collaborator

@iwiznia @shawnborton Don't you think for Expensify the badge is too close to y ?

Screenshot 2026-11-13 at 4 14 23 AM Screenshot 2026-11-13 at 4 15 05 AM

@mananjadhav

Copy link
Copy Markdown
Collaborator

Other pages look okay:

Screenshot 2026-11-13 at 4 11 09 AM Screenshot 2026-11-13 at 4 11 25 AM

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

If we ever wanted more differentiation then we could do some fun devvy app icons too:

CleanShot 2026-11-13 at 9 26 56 AM@2x

@trjExpensify trjExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Customers* are going to love it! 👍

*Ionatan.

@iwiznia

iwiznia commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Customers* are going to love it! 👍

lol yeah, it's mostly so it's easier to know if a screenshot/video was taken from prod or staging.

@iwiznia

iwiznia commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@shawnborton please check it out and merge if you are happy

@shawnborton

Copy link
Copy Markdown
Contributor

@dubielzyk-expensify I LOVE that blue app icon! We should totally make that the home screen icon for test flights too! Anyways, going to merge this as-is but follow ups are welcome 🤗

@shawnborton
shawnborton merged commit f966d70 into main Nov 13, 2026
47 of 52 checks passed
@shawnborton
shawnborton deleted the ionatan_readdenvironmentbadge branch November 13, 2026 08:42
@github-actions

Copy link
Copy Markdown
Contributor

🚧 shawnborton has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

@shawnborton

Copy link
Copy Markdown
Contributor

@iwiznia this isn't going to work so well with the flat nav UI:

CleanShot 2026-11-13 at 12 37 34 PM@2x

Can you create a follow up to fix that? Not sure where is best to put it, or maybe we don't need all of that info and we an just say "Adhoc" like we used to?

@shawnborton

Copy link
Copy Markdown
Contributor

I also think we should have a toggle in the dev settings menu to hide the environment badge, this way if you are taking screenshots, it won't be there.

@dubielzyk-expensify

Copy link
Copy Markdown
Contributor

Yeah I wonder if we can just say Adhoc and then have those values revealed on hover (alt tag or tooltip)?

@dannymcclain

Copy link
Copy Markdown
Contributor

I LOVE that blue app icon! We should totally make that the home screen icon for test flights too!

Daaaaang I love this too. Obviously it's going away with flat nav, but I 100% agree if there's an opportunity to use this internally we should haha.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/shawnborton in version: 9.5.40-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

No help site update needed — this PR only restores an environment badge in non-production builds and does not change any customer-facing workflow or make existing help content incorrect.


view run

@shawnborton

Copy link
Copy Markdown
Contributor

Looks like we show the staging badge too many times, too?

CleanShot 2026-11-17 at 1 58 32 PM@2x

@iwiznia

iwiznia commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

@shawnborton @dubielzyk-expensify sent the follow up here #107183 (shows ADHOC with the version and PR in a tooltip, and adds a switch in Troubleshoot to hide the badge)

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.5.40-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants